<template>
    <div>
        <!-- ----------- 严晴---------- -->
        <div class="modifyCustomers">
            <h3 class="lh">修改客户</h3>
            <el-form
                :label-position="labelPosition"
                label-width="80px"
                :model="getModifyCustomersData"
            >
                <el-form-item label="姓名">
                    <el-input v-model="getModifyCustomersData.name"></el-input>
                </el-form-item>
                <el-form-item label="年龄">
                    <el-input v-model="getModifyCustomersData.age"></el-input>
                </el-form-item>
                <el-form-item label="性别">
                    <el-input
                        v-model="getModifyCustomersData.gender"
                    ></el-input>
                </el-form-item>
                <el-form-item label="联系方式">
                    <el-input v-model="getModifyCustomersData.phone"></el-input>
                </el-form-item>
                <el-form-item label="身份证">
                    <el-input
                        v-model="getModifyCustomersData.IDCard"
                        :disabled="true"
                    ></el-input>
                </el-form-item>
            </el-form>
            <div class="lh">
                <el-button type="success" @click="confirmModifyCustomers"
                    >确认修改</el-button
                >
            </div>
        </div>
    </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
var { mapActions, mapState } = createNamespacedHelpers("customers");
export default {
    data() {
        return {
            labelPosition: "right",
        };
    },
    computed: {
        //在计算属性中调用辅助函数
        ...mapState(["getModifyCustomersData"]),
    },
    methods: {
        ...mapActions(["getModifyCustomers", "modifyCustomers"]),
        confirmModifyCustomers() {
            this.modifyCustomers(this.getModifyCustomersData);
        },
    },
    created() {
        this.getModifyCustomers(this.$route.params._id);
    },
};
</script>

<style lang=scss>
.modifyCustomers {
    background-color: #fff;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}
.lh {
    line-height: 50px;
}
.modifyCustomers .el-form {
    width: 600px;
    text-align: center;
    margin: 0px auto;
}
</style>